#! /usr/bin/python

import sys

MAX = 10**5
total = 0

for m in range(1, 12911):
    for n in range(m+1, 12911, 2):
	c = n**2 + m**2
	b = n**2 - m**2
	a = 2*m*n
	p = 3*c
	if 2*b == c+1:
	   total += p + 1
	   print c, p, m, n
	if 2*a == c-1:
	   total += p - 1
	   print c, p, m, n
print total
